package com.ruoyi.teach.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teach.mapper.TeachCourseMapper;
import com.ruoyi.teach.domain.TeachCourse;
import com.ruoyi.teach.service.ITeachCourseService;

/**
 * 课程管理Service业务层处理
 * 
 * @author yepanpan
 * @date 2021-03-15
 */
@Service
public class TeachCourseServiceImpl implements ITeachCourseService 
{
    @Autowired
    private TeachCourseMapper teachCourseMapper;

    /**
     * 查询课程管理
     * 
     * @param id 课程管理ID
     * @return 课程管理
     */
    @Override
    public TeachCourse selectTeachCourseById(Long id)
    {
        return teachCourseMapper.selectTeachCourseById(id);
    }

    /**
     * 查询课程管理列表
     * 
     * @param teachCourse 课程管理
     * @return 课程管理
     */
    @Override
    public List<TeachCourse> selectTeachCourseList(TeachCourse teachCourse)
    {
        return teachCourseMapper.selectTeachCourseList(teachCourse);
    }

    /**
     * 新增课程管理
     * 
     * @param teachCourse 课程管理
     * @return 结果
     */
    @Override
    public int insertTeachCourse(TeachCourse teachCourse)
    {
        teachCourse.setCreateTime(DateUtils.getNowDate());
        teachCourse.setCreateBy(SecurityUtils.getUsername());
        return teachCourseMapper.insertTeachCourse(teachCourse);
    }

    /**
     * 修改课程管理
     * 
     * @param teachCourse 课程管理
     * @return 结果
     */
    @Override
    public int updateTeachCourse(TeachCourse teachCourse)
    {
        teachCourse.setUpdateTime(DateUtils.getNowDate());
        teachCourse.setUpdateBy(SecurityUtils.getUsername());
        return teachCourseMapper.updateTeachCourse(teachCourse);
    }

    /**
     * 批量删除课程管理
     * 
     * @param ids 需要删除的课程管理ID
     * @return 结果
     */
    @Override
    public int deleteTeachCourseByIds(Long[] ids)
    {
        return teachCourseMapper.deleteTeachCourseByIds(ids);
    }

    /**
     * 删除课程管理信息
     * 
     * @param id 课程管理ID
     * @return 结果
     */
    @Override
    public int deleteTeachCourseById(Long id)
    {
        return teachCourseMapper.deleteTeachCourseById(id);
    }
}
